﻿<Application x:Class="SoGame.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:helpers="clr-namespace:SoGame.Helper"
             StartupUri="Views/MainWindow.xaml">
    <Application.Resources>
        <!-- Resources scoped at the Application level should be defined here. -->
        <ResourceDictionary>
            
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Assets/Brushes.xaml"/>
                <ResourceDictionary Source="Assets/CoreStyles.xaml"/>
                <ResourceDictionary Source="Assets/Fonts.xaml"/>
                <ResourceDictionary Source="Assets/Styles.xaml"/>
                
                <ResourceDictionary Source="/Themes/TextBlock.xaml"/>
                <ResourceDictionary Source="/Themes/Buttons.xaml"/>
                <ResourceDictionary Source="/Themes/Scrollbar.xaml"/>
                <ResourceDictionary Source="/Themes/Scrollviewer.xaml"/>
                <ResourceDictionary Source="/Themes/RadioButton.xaml"/>
                <ResourceDictionary Source="/Themes/ProgressBar.xaml"/>
                <ResourceDictionary Source="/Themes/ContextMenu.xaml"/>
                <ResourceDictionary Source="/Themes/Tooltip.xaml"/>
                <ResourceDictionary Source="/Themes/Checkbox.xaml"/>
                <ResourceDictionary Source="/Themes/Combobox.xaml"/>
                <ResourceDictionary Source="/Themes/Slider.xaml"/>
                <ResourceDictionary Source="/Themes/Expander.xaml"/>
                <ResourceDictionary Source="/Themes/textbox.xaml"/>
                <ResourceDictionary Source="/Themes/geometry.xaml"/>
                <ResourceDictionary Source="/Themes/Generic.xaml"/>
                <ResourceDictionary Source="/Themes/ListBox.xaml"/>
                    
            </ResourceDictionary.MergedDictionaries>

            <helpers:BoolToVisibleOrHidden x:Key="VisibilityConverter"/>
            <helpers:FacebookStatusToVisibilityConverter x:Key="FacebookVisibilityConverter"/>

            <ControlTemplate x:Key="WindowTemplateKey" TargetType="{x:Type Window}">
                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                    <Grid>
                        <AdornerDecorator>
                            <ContentPresenter/>
                        </AdornerDecorator>
                        <ResizeGrip x:Name="WindowResizeGrip" HorizontalAlignment="Right" IsTabStop="false" Visibility="Collapsed" VerticalAlignment="Bottom"/>
                    </Grid>
                </Border>
                <ControlTemplate.Triggers>
                    <MultiTrigger>
                        <MultiTrigger.Conditions>
                            <Condition Property="ResizeMode" Value="CanResizeWithGrip"/>
                            <Condition Property="WindowState" Value="Normal"/>
                        </MultiTrigger.Conditions>
                        <Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Visible"/>
                    </MultiTrigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
            
            <Style x:Key="WindowStyle" TargetType="{x:Type Window}">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Window}">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                                <AdornerDecorator>
                                    <ContentPresenter/>
                                </AdornerDecorator>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <Trigger Property="ResizeMode" Value="CanResizeWithGrip">
                        <Setter Property="Template" Value="{StaticResource WindowTemplateKey}"/>
                    </Trigger>
                </Style.Triggers>
            </Style>

        </ResourceDictionary>
    </Application.Resources>
</Application>